
#include "main_inc.h"
#include "clog.h"
#include "SDL.h"
#include "App.h"
#include "exceptions.h"

//
//void MoveSprites ( SDL_Surface *screen, Uint32 background )
//{
//	int i, nupdates;
//	SDL_Rect area, *position, *velocity;
//	nupdates = 0;
//
//	/* Erase all the sprites if necessary */
//	if ( sprites_visible ) {
//		SDL_FillRect ( screen, NULL, background );
//	}
//
//	/* Move the sprite, bounce at the wall, and draw */
//	for ( i = 0; i < numsprites; ++i ) {
//		position = &positions[i];
//		velocity = &velocities[i];
//		position->x += velocity->x;
//
//		if ( ( position->x < 0 ) || ( position->x >= ( screen->w - sprite_w ) ) ) {
//			velocity->x = -velocity->x;
//			position->x += velocity->x;
//		}
//
//		position->y += velocity->y;
//
//		if ( ( position->y < 0 ) || ( position->y >= ( screen->h - sprite_w ) ) ) {
//			velocity->y = -velocity->y;
//			position->y += velocity->y;
//		}
//
//		/* Blit the sprite onto the screen */
//		area = *position;
//		SDL_BlitSurface ( sprite, NULL, screen, &area );
//		sprite_rects[nupdates++] = area;
//	}
//
//	/* Update the screen! */
//	if ( ( screen->flags & SDL_DOUBLEBUF ) == SDL_DOUBLEBUF ) {
//		SDL_Flip ( screen );
//	}
//	else {
//		SDL_UpdateRects ( screen, nupdates, sprite_rects );
//	}
//
//	sprites_visible = 1;
//}
//
//Uint32 FastestFlags ( Uint32 flags, int width, int height, int bpp )
//{
//	const SDL_VideoInfo *info;
//	flags |= SDL_FULLSCREEN;
//	info = SDL_GetVideoInfo();
//
//	if ( info->blit_hw_CC && info->blit_fill ) {
//		flags |= SDL_HWSURFACE;
//	}
//
//	if ( ( flags & SDL_HWSURFACE ) == SDL_HWSURFACE ) {
//		if ( info->video_mem * 1024 > ( height * width * bpp / 8 ) ) {
//			flags |= SDL_DOUBLEBUF;
//		}
//		else {
//			flags &= ~SDL_HWSURFACE;
//		}
//	}
//
//	return ( flags );
//}

int main ( int argc, char *argv[] )
{
	CLog log;
	log.StartLog ( "game-on.log" );
	App me;

	try
	{
		me.RunThisShit();
	}
	catch ( cexception )
	{
		LOGP1 ( "Oooops! \n Exception caught in main func! " );
		me.CleanUp();
	}
	catch ( ... )
	{
		LOGP1 ( "Oooops x 2 ! \n Unknown exception caught in main func !!!" );
		me.CleanUp();
		return 0xFFFF;
	}

	return ( 0 );
}





